package com.supermap.business.temp;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dataservice.util.Table;
import com.supermap.dubbo.api.temp.TempUserNMService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author:langhongshuai
 * @Description:临时内蒙大户用户接口表
 * @Date:18/8/10 上午10:46
 */
@Controller
@RequestMapping("TempUserNMController")
public class TempUserNMController {

    /**
     * 使用指定类初始化日志对象，在日志输出的时候，可以打印出日志信息所在类
     */
    protected static final Logger logger = LoggerFactory.getLogger(TempUserNMController.class);

    @Reference
    private TempUserNMService tempUserNMService;


    /**
     *
     * 获取所有的大户信息
     * @param table
     * @return
     */
    @RequestMapping("getUserInfoByAreaname")
    @ResponseBody
    public JSONUtil getUserInfoByAreaname(HttpServletRequest request, Table table){
        String areaname =request.getParameter("areaname");
        return tempUserNMService.getUserInfoByAreaname(areaname,table);
    }

    /**
     * 通过区域名获取区域用户数总数
     * @param areaname
     * @return
     */
    @RequestMapping("getUserInfoCountByAreaname")
    @ResponseBody
    public JSONUtil getUserInfoCountByAreaname(String areaname){
        return tempUserNMService.getUserInfoCountByAreaname(areaname);
    }
}
